
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>


<script>


    //promise 失败回调
    //catch的用法是直接获取到promise的失败结果
    const p = new Promise((resolve,reject)=>{
        setTimeout(function(){
            reject('设置了一个错误返回方式');
        },1000);
    });

    p.catch(function(reason){
        console.warn(reason);
    })


</script>
</html>